import React from 'react';
import {inject, observer} from 'mobx-react';
import {Icon} from 'antd';
import {toJS} from 'mobx';
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;

@inject('weesoStore','routing')
@observer
export default class AboutBrowser extends React.Component {
  render() {
    const {weesoStore, routing} = this.props;
    let {contentType, defalutMoreKey, inputValue} = weesoStore;
    contentType = toJS(contentType);
    if(!contentType || contentType.length === 0){//undified页面会有哥0
      return null
    }
    return (
      <div>
        {
          contentType.map(item => {
            if (item.adlink && item.key == weesoStore.defalutMoreKey && window.doThemeAction) {
              // 单页不存在window.doThemeAction，不显示转到其他模块 
              return (
                <span
                  className="weeso-cursor result-link"
                  title={getLabel(384215,'点击进入原搜索界面，进行详细搜索')}
                  onClick={() => {
                    if(defalutMoreKey == 'DOC'){
                      routing.push('/main/document/search?viewcondition=2&docsubject='+inputValue);
                    }else {
                      window.doThemeAction('onQuickSearch', {
                        from: 'fullSearch',
                        type: item.linktype,
                        value: weesoStore.inputValue
                      })
                    }
                  }}
                >
                  {getLabel(128861, `${getLabel(23162,'转到')}${item.name}${getLabel(384217,'模块搜索')}`)}&nbsp;
                  <Icon ecId={`${this && this.props && this.props.ecId || ''}_Icon@ix0tfe@${item.key}`} type="double-right"/>
                </span>
              )
            }
          })
        }
      </div>
    )
  }
}